incomes=[]
expenses=[]
def record_income():
    date=input("日期(YYYY-MM-DD):")
    try:
        datetime.datetime.strptime(date,"%Y-%m-%d")
    #日期验证
    except ValueError:
        print("错误：日期格式不正确.")
        return
    amount=input("金额:")
    try:
        amount=float(amount)
        if amount<=0:
            print("金额必须为正数！")
            return
    except ValueError:
        print("金额格式错误，请输入一个数字！")
        return
    category=input("")
    remark=input("")
    incomes.append({"日期":date,"金额":amount,"类别":category,"备注":remark})
    print("收入已成功记录！")
def record_expense():
    date=input("日期(YYYY-MM-DD):")
    try:
        datetime.datetime.strptime(date,"%Y-%m-%d")
    except ValueError:
        print("错误：日期格式不正确.")
        return
    amount=input("金额:")
    try:
        amount=float(amount)
        if amount<=0:
            print("金额必须为正数！")
            return
    except ValueError:
        print("金额格式错误，请输入一个数字！")
        return
    category=input("类别：")
    remark=input("备注：")
    expenses.append({"日期":date,"金额":amount,"类别":category,"备注":remark})
    print("支出已成功记录！")
    print("?")
